#include "aaKeyboard.h"

int AA_Keyboard::init ( void* data ) {
   context = (struct aa_context*) data;
   aa_autoinitkbd ( context, AA_SENDRELEASE );
   return 0;
}

int AA_Keyboard::getEvent () {
   int key;
   key = aa_getevent ( context, 0 ); 
#define CASE( key ) case AA_##key : return AG_KEY_##key
   switch ( key ) {
      CASE( UP );
      CASE( DOWN );
      CASE( LEFT );
      CASE( RIGHT );
      default : return key;
#undef CASE
   }
}

void AA_Keyboard::done () {
   aa_uninitkbd ( context );
}
